<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\User;

class Answer extends Model
{
    //
    public function user()
    {
        return $this->belongsTo('App\User');
    }
    public function question()
    {
        return $this->belongsTo('App\Question');
    }

    public function onezan($user_id)
    {
        return $this->hasOne(\App\Zan::class)->where('user_id',$user_id);
    }
    public function zan()
    {
        return $this->hasMany('App\Zan');
    }
}
